/*****************************************************************************/
/**
 *  @file   main.cpp
 *  @author Jun Nishimura, Naohisa Sakamoto
 */
/*----------------------------------------------------------------------------
 *
 *  Copyright (c) Visualization Laboratory, Kyoto University.
 *  All rights reserved.
 *  See http://www.viz.media.kyoto-u.ac.jp/kvs/copyright/ for details.
 *
 *  $Id$
 */
/*****************************************************************************/
#include <tdw/Application.h>
#include <tdw/Screen.h>

using namespace kvstileddisplayvis;

class PaintEvent : public kvs::PaintEventListener
{
    void update( void )
    {
        if ( tdw::Application::IsRenderer() )
        {
            glBegin( GL_TRIANGLES );
            glColor3ub( 255,   0,   0 ); glVertex3d(  0.0,  3.0, 0.0 ); // c0, v0
            glColor3ub(   0, 255,   0 ); glVertex3d(  3.0, -3.0, 0.0 ); // c1, v1
            glColor3ub(   0,   0, 255 ); glVertex3d( -3.0, -3.0, 0.0 ); // c2, v2
            glEnd();
        }
    }
};

int main( int argc, char** argv )
{
    tdw::Application app( argc, argv );
    tdw::Screen screen( &app );

    PaintEvent paint_event;
    screen.addPaintEvent( &paint_event );

    screen.show();

    return ( app.run() );
}
